﻿namespace Framework.HttpRequestService
{
    /// <summary>
    /// Http请求服务
    /// </summary>
    public interface IHttpHelpService
    {
        /// <summary>
        /// Http请求-Get
        /// </summary>
        /// <param name="url">API-Url</param>
        /// <param name="address">接口地址</param>
        /// <param name="data">入参（可为空）</param>
        /// <param name="headers">请求头</param>
        /// <returns></returns>
        public string HttpGet(string url, string address, object data, Dictionary<string, object> headers = null);

        /// <summary>
        /// Http请求-get
        /// </summary>
        /// <param name="url">API-Url</param>
        /// <param name="address">接口地址</param>
        /// <param name="data">入参（可为空）</param>
        /// <param name="headers">请求头</param>
        /// <returns></returns>
        public T HttpGetConvert<T>(string url, string address, object data, Dictionary<string, object> headers = null);

        /// <summary>
        /// Http请求-Get
        /// </summary>
        /// <param name="url">API-Url</param>
        /// <param name="address">接口地址</param>
        /// <param name="data">入参（可为空）</param>
        /// <param name="headers">请求头</param>
        /// <returns></returns>
        public Task<string> HttpGetAsync(string url, string address, object data, Dictionary<string, object> headers = null);

        /// <summary>
        /// Http请求-get
        /// </summary>
        /// <param name="url">API-Url</param>
        /// <param name="address">接口地址</param>
        /// <param name="data">入参（可为空）</param>
        /// <param name="headers">请求头</param>
        /// <returns></returns>
        public Task<T> HttpGetConvertAsync<T>(string url, string address, object data, Dictionary<string, object> headers = null);

        /// <summary>
        /// Http请求-Post
        /// </summary>
        /// <param name="url">API-Url</param>
        /// <param name="address">接口地址</param>
        /// <param name="data">入参（可为空）</param>
        /// <param name="headers">请求头</param>
        /// <returns></returns>
        public string HttpPost(string url, string address, object data, Dictionary<string, object> headers = null);

        /// <summary>
        /// Http请求-Post
        /// </summary>
        /// <param name="url">API-Url</param>
        /// <param name="address">接口地址</param>
        /// <param name="data">入参（可为空）</param>
        /// <param name="headers">请求头</param>
        /// <returns></returns>
        public T HttpPostConvert<T>(string url, string address, object data, Dictionary<string, object> headers = null);

        /// <summary>
        /// Http请求-Post
        /// </summary>
        /// <param name="url">API-Url</param>
        /// <param name="address">接口地址</param>
        /// <param name="data">入参（可为空）</param>
        /// <param name="headers">请求头</param>
        /// <returns></returns>
        public Task<string> HttpPostAsync(string url, string address, object data, Dictionary<string, object> headers = null);

        /// <summary>
        /// Http请求-Post
        /// </summary>
        /// <param name="url">API-Url</param>
        /// <param name="address">接口地址</param>
        /// <param name="data">入参（可为空）</param>
        /// <param name="headers">请求头</param>
        /// <returns></returns>
        public Task<T> HttpPostConvertAsync<T>(string url, string address, object data, Dictionary<string, object> headers = null);
    }
}
